<template>
    <div class="cms-catalog">
        <div class="cms-catalog-org">
            <el-table
                    border
                    default-expand-all
                    highlight-current-row
                    :data="catalogTable"
                    row-key="id"
                    height="500"
                    size="mini"
                    style="width: 100%"
                    :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                <el-table-column
                        prop="name"
                        label="name"
                        width="*">
                </el-table-column>
            </el-table>
        </div>
        <div class="cms-catalog-table">
            <div style="height: 35px">
                <el-form :model="searchForm" :inline="true" size="mini">
                    <el-form-item label="name">
                        <el-input v-model="searchForm.name"></el-input>
                    </el-form-item>
                    <el-form-item label="code">
                        <el-input v-model="searchForm.code"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="listCatalog">Search</el-button>
                        <el-button type="primary" @click="listCatalog">Refresh</el-button>
                        <el-button type="primary" @click="handleCreate">New</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <el-table
                    border
                    highlight-current-row
                    row-key="ukId"
                    height="500"
                    size="mini"
                    :data="catalogTable"
                    style="width: 100%">
                <el-table-column
                        type="selection"
                        width="55">
                </el-table-column>
                <el-table-column
                        prop="account"
                        label="account"
                        width="*">
                </el-table-column>
                <el-table-column
                        prop="catalogname"
                        label="catalogname"
                        width="180">
                </el-table-column>
                <el-table-column
                        prop="status"
                        label="status"
                        width="70">
                    <template slot-scope="scope">
                        <el-switch
                                :value="scope.row.status != '1'"
                                active-color="#909399"
                                inactive-color="#67c23a">
                        </el-switch>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="sort"
                        label="sort"
                        width="60">
                </el-table-column>
                <el-table-column
                        label="操作"
                        width="170">
                    <template slot-scope="scope">
                        <el-button
                                size="mini">编辑
                        </el-button>
                        <el-button
                                size="mini">重置密码
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
  import TreeSelect from '@riophae/vue-treeselect'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'

  export default {
    name: "Catalog",
    components: {TreeSelect},
    data () {
      return {
        showCatalogForm: false,
        catalogForm: {},
        searchForm: {},
        catalogTable: []
      }
    },
    mounted () {
    },
    methods: {},
    created () {

    }
  }
</script>

<style>
    .cms-catalog {
        width: 100%;
        height: 100%;
    }

    .cms-catalog-org {
        width: 300px;
        height: calc(100% - 35px);
        float: left;
    }

    .cms-catalog-table {
        padding-left: 5px;
        width: calc(100% - 305px);
        height: calc(100% - 35px);
        float: left;
    }

    /* element ui样式重写 */
    .cms-catalog > .cms-catalog-org > .el-table,
    .cms-catalog > .cms-catalog-table > .el-table {
        height: calc(100% - 5px) !important;
    }

    .cms-catalog > .cms-catalog-table > .el-table > .el-table__body-wrapper {
        height: calc(100% - 5px) !important;
    }
</style>
